const express = require('express')
const router = express.Router()
// const adminServ = require('../../services/adminService')
const { asyncHandler } = require('../getSendResult')
// const jwt = require('../jwt')
const adminValidator = require('../../validator/admin')
const adminCtrl = require('../../controller/admin')

router.post('/login', adminValidator.login, adminCtrl.login)

// 获取用户信息
router.get('/', adminCtrl.getAdmin)

// 获取所有管理员
router.get('/allAdmins', adminCtrl.getAdmins)

router.delete('/:adminId', adminCtrl.deleteAdmin)

// 添加管理员
router.post('/', adminValidator.addAdmin, adminCtrl.addAdmin)

// 修改密码
router.put('/', adminCtrl.updateAdmin)

module.exports = router
